﻿<Window x:Class="WPFApplication.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="So sánh văn bản - Demo" Height="600" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="50px"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="200px"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <GroupBox Grid.Column="1"
                  Header="Văn bản 2"
                  Name="panel2"
                  IsEnabled="False">
            <Grid >
                <Label VerticalAlignment="Center" Content="Tập tin:"/>
                <TextBox VerticalAlignment="Center"
        			x:Name="txtPath1"
        			HorizontalAlignment="Stretch"
        			Width="Auto"
        			Margin="60,0,100,0"
        			Grid.ColumnSpan="2" 
        			Height="20" TextWrapping="Wrap" 
        			Text="" BorderBrush="{x:Null}" IsEnabled="False"/>
                <Button Content="Mở"
        			Grid.Column="1"
        			HorizontalAlignment="Right" 
        			Margin="20,0,10,0" 
        			VerticalAlignment="Center" 
        			BorderBrush="Transparent"
        			Width="75"
        			Click="btnOpen1_Click"/>
            </Grid>
        </GroupBox>
        <GroupBox Header="Tập tin văn bản" 
        	HorizontalAlignment="Stretch" 
        	Margin="10,10,10,40" 
        	Grid.Row="1"
        	Grid.RowSpan="1"
        	VerticalAlignment="Stretch" BorderBrush="#FFBFC9CF">

            <DocumentViewer x:Name="docViewer" Background="White" Margin="0,10,0,0"/>

        </GroupBox>

        <TabControl Grid.Row="1"
                    Name="tabControl"
                    Grid.Column="1"
                    Margin="10,10,10,40" SelectionChanged="tabControl_SelectionChanged">
            <TabItem Header="Văn bản">
                <TextBox HorizontalAlignment="Stretch"
                     Name="txtInput"
                     TextWrapping="Wrap" 
                     Text="Nhập văn bản..."
                     BorderBrush="Transparent"
                     VerticalAlignment="Stretch" FontSize="15"/>
            </TabItem>
            <TabItem Header="Tập tin văn bản">
                <DocumentViewer x:Name="docViewer1" Background="White"/>
            </TabItem>
        </TabControl>
        <Button Content="Xử lý" 
                Grid.Column="1" 
                HorizontalAlignment="Right" 
                Margin="0,0,10,10" 
                Grid.Row="1" 
                VerticalAlignment="Bottom"
                BorderBrush="Transparent"
                Width="75" Click="btnXuLy_Click"/>
        <Label Grid.Row="1"
               Grid.Column="1"
               HorizontalAlignment="Left"
               VerticalAlignment="Bottom"
               Margin="10,10,10,7">Chế độ</Label>
        <ComboBox Grid.Column="1"
                  Name="cbbMode"
                  HorizontalAlignment="Right" 
                  Margin="0,0,96,10" Grid.Row="1" 
                  VerticalAlignment="Bottom" 
                  Width="240"
                  SelectedIndex="0">
            <ComboBoxItem Content="So sánh thường" HorizontalAlignment="Left" Width="238"/>
            <ComboBoxItem Content="So sánh từ khóa" HorizontalAlignment="Left" Width="238"/>
        </ComboBox>
        <GroupBox Grid.Row="1"
                  VerticalAlignment="Bottom"
                  Margin="10,0,10,0">
            <StackPanel Orientation="Horizontal">
                <RadioButton Content="Max"
                             Name="ckbMax"
                             Margin="10,0,10,0"
                             IsChecked="True"/>
                <RadioButton Content="Min"
                             Name="ckbMin"
                             Margin="10,0,10,0"/>
                <Button Content="Save Text File"
                        Margin="10,0,0,0"
                        Name="btnSaveTxt"
                        Click="btnSaveTxt_Click"/>
                <Button Content="Save XML File"
                        Margin="10,0,0,0"
                        Name="btnSaveXML"
                        Click="btnSaveXML_Click"/>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Column="0"
                  Grid.ColumnSpan="2"
                  Header="Kết quả" 
                  HorizontalAlignment="Stretch"
                  Margin="10,10,150,10"
                  Grid.Row="2"
                  VerticalAlignment="Stretch">
            <ListBox HorizontalAlignment="Stretch"
                     Name="lbInfo"
                     VerticalAlignment="Stretch"
                     HorizontalContentAlignment="Stretch"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                     BorderBrush="Transparent" FontSize="15" SelectionChanged="lbInfo_SelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border BorderThickness="0,0,0,4" BorderBrush="Gray">
                            <Grid Background="{Binding BackgroundColor}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="50"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding Text}"
                                       Foreground="{Binding ForegroundColor}"
                                       Grid.Column="0"
                                           Grid.Row="1"
                                           Margin="10,0,10,0"
                                   TextWrapping="Wrap"/>
                                <TextBlock Text="{Binding Text1}"
                                       Foreground="{Binding ForegroundColor}"
                                       Grid.Column="1"
                                           Grid.Row="1"
                                           Margin="10,0,10,0"
                                   TextWrapping="Wrap"/>
                                <Label Content="{Binding Ratio}"
                                       Foreground="{Binding ForegroundColor}"
                                       Grid.ColumnSpan="2"
                                       FontSize="25"
                                       FontWeight="Bold"
                                       BorderBrush="{Binding ForegroundColor}"
                                   />
                            </Grid>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </GroupBox>
        <GroupBox Header="Điểm toàn văn bản"
                  Grid.Column="1"
                  Grid.Row="2"
                  VerticalAlignment="Stretch"
                  HorizontalAlignment="Right"
                  Width="130px"
                  Margin="0,10,10,10">
            <Label Name="txtScore"
                   HorizontalContentAlignment="Center"
                   VerticalContentAlignment="Center"
                   FontSize="50"/>
        </GroupBox>
        <GroupBox
        	Header="Văn bản 1"
        	Margin="10,0">
            <Grid>
                <Label VerticalAlignment="Center" Content="Tập tin:"/>
                <TextBox VerticalAlignment="Center"
        			x:Name="txtPath"
        			HorizontalAlignment="Stretch"
        			Width="Auto"
        			Margin="60,0,100,0"
        			Grid.ColumnSpan="2" 
        			Height="20" TextWrapping="Wrap" 
        			Text="" BorderBrush="{x:Null}" IsEnabled="False"/>
                <Button Content="Mở"
        			Grid.Column="1"
        			HorizontalAlignment="Right" 
        			Margin="20,0,10,0" 
        			VerticalAlignment="Center" 
        			BorderBrush="Transparent"
        			Width="75"
        			Click="btnOpen_Click"/>
            </Grid>
        </GroupBox>


    </Grid>

</Window>
